--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_reiuji_utsuho = General:new(extension, "hy_reiuji_utsuho", "chi_k", 3, 3, General.Female)
    local peta_flare = fk.CreateSkill {
        name = "peta_flare",
    }
    peta_flare:addEffect("viewas", {
        mute_card = false,
        anim_type = "offensive",
        pattern = "fire__slash",
        card_num = 1,
        card_filter = function(self, player, to_select, selected)
            return #selected < 1 and table.contains(player:getCardIds("h"), to_select) and Fk:getCardById(to_select).suit == Card.Diamond
        end,
        prompt = function(self, selected, selected_cards)
            return "peta_flare_prompt"
        end,
        view_as = function(self, player, cards)
            if #cards == 0 then
                return
            end
            local card = Fk:cloneCard("fire__slash")
            card:addSubcards(cards)
            table.insertIfNeed(card.skillNames, peta_flare.name)
            return card
        end,
        before_use = function(self, player, use)
            use.extraUse = true
        end,

        enabled_at_play = function(self, player)
            return player.phase == Player.Play
        end,
        enabled_at_response = Util.FalseFunc,
    })
    peta_flare:addEffect("targetmod", {
        extra_target_func = function(self, player, skill, card)
            if card and card.trueName == "slash" and table.contains(card.skillNames, "peta_flare") then
                return 999
            end
        end,
    })
    peta_flare:addEffect(fk.CardUseFinished, {
        anim_type = "drawcard",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(peta_flare.name) and table.contains(data.card.skillNames, "peta_flare") and not table.every(data:getAllTargets(), function(t)
                return data.damageDealt and data.damageDealt[t] and data.damageDealt[t] > 0
            end)
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            player.room:loseHp(player, 1, peta_flare.name)
        end
    })
    local nuclear_fusion = fk.CreateSkill {
        name = "nuclear_fusion",
    }
    nuclear_fusion:addEffect(fk.EventPhaseStart, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(nuclear_fusion.name) and player.maxHp < 6 and player.phase == Player.Start
        end,
        on_cost = Util.TrueFunc,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local result = room:askToChoice(player, {
                choices = { "1", "2", "3" },
                skill_name = nuclear_fusion.name,
                prompt = "nuclear_fusion_prompt"
            })
            room:changeMaxHp(player, math.max(0, tonumber(result)))
        end,
    })
    local flaming_sun = fk.CreateSkill {
        name = "flaming_sun",
        tags = {
            Skill.Wake,
        }
    }
    flaming_sun:addEffect(fk.EnterDying, {
        anim_type = "drawcard",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(self) and player:usedSkillTimes(flaming_sun.name, Player.HistoryGame) == 0
        end,
        can_wake = function(self, event, target, player, data)
            return target == player
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            room:recover({
                who = player,
                num = 4,
                skillName = flaming_sun.name,
                recoverBy = player,
            })
            room:handleAddLoseSkills(player, "self_destroy|cross_sun")
        end,
    })
    local cross_sun = fk.CreateSkill {
        name = "cross_sun",
    }
    cross_sun:addEffect(fk.HpLost, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            if not player:hasSkill(cross_sun.name) or target ~= player then
                return false
            end
            return table.any(player.room.discard_pile, function(id)
                return Fk:getCardById(id).number == player.maxHp and player:canUse(Fk:getCardById(id), { bypass_times = true })
            end)
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            local cards = table.filter(room.discard_pile, function(id)
                return Fk:getCardById(id).number == player.maxHp and player:canUse(Fk:getCardById(id), { bypass_times = true })
            end)
            HY.ReplaceHandCardToTempNew(player, cards)
            local success, result = room:askToUseActiveSkill(player, {
                skill_name = "cross_sun_viewas",
                prompt = "cross_sun_prompt",
                extra_data = { bypass_times = true }
            })
            HY.ReverseHandCardFromTempNew(player)
            event:setCostData(self, result)
            return success
        end,
        on_use = function(self, event, target, player, data)
            player.room:useCard({
                from = player,
                tos = event:getCostData(self).targets,
                card = Fk:getCardById(event:getCostData(self).cards[1]),
                extraUse = true,
            })
        end,
    })
    cross_sun:addEffect(fk.MaxHpChanged, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            if not player:hasSkill(cross_sun.name) or target ~= player then
                return false
            end
            return data.num < 0
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            local cards = table.filter(room.discard_pile, function(id)
                return Fk:getCardById(id).number == player.maxHp and player:canUse(Fk:getCardById(id), { bypass_times = true })
            end)
            HY.ReplaceHandCardToTempNew(player, cards)
            local success, result = room:askToUseActiveSkill(player, {
                skill_name = "cross_sun_viewas",
                prompt = "cross_sun_prompt",
                skip = true,
                extra_data = { bypass_times = true }
            })
            HY.ReverseHandCardFromTempNew(player)
            event:setCostData(self, result)
            return success
        end,
        on_use = function(self, event, target, player, data)
            player.room:useCard({
                from = player,
                tos = event:getCostData(self).targets,
                card = Fk:getCardById(event:getCostData(self).cards[1]),
                extraUse = true,
            })
        end,
    })
    local cross_sun_viewas = fk.CreateSkill {
        name = "cross_sun_viewas",
    }
    cross_sun_viewas:addEffect("viewas", {
        card_num = 1,
        expand_pile = function(self, player)
            return player:getTableMark("#tempMove")
        end,
        card_filter = function(self, player, to_select, selected)
            if #selected == 0 then
                return table.contains(player:getTableMark("#tempMove"), to_select) and player:canUse(Fk:getCardById(to_select))
            end
        end,
        view_as = function(self, player, cards)
            if #cards ~= 1 then
                return
            end
            return Fk:getCardById(cards[1])
        end,
    })
    extension:loadSkillSkels { peta_flare, nuclear_fusion, flaming_sun, cross_sun, cross_sun_viewas }
    hy_reiuji_utsuho:addSkill("peta_flare")
    hy_reiuji_utsuho:addSkill("nuclear_fusion")
    hy_reiuji_utsuho:addSkill("flaming_sun")
    hy_reiuji_utsuho:addRelatedSkill("self_destroy")
    hy_reiuji_utsuho:addRelatedSkill("cross_sun")
    Fk:loadTranslationTable {
        ["hy_reiuji_utsuho"] = "灵乌路空",
        ["#hy_reiuji_utsuho"] = "不可控能源",
        ["illustrator:hy_reiuji_utsuho"] = "Blanc.",
        ["designer:hy_reiuji_utsuho"] = "黑曜人形",
        ["cv:hy_reiuji_utsuho"] = "",

        ["peta_flare"] = "爆焰",
        [":peta_flare"] = "出牌阶段，你可以将一张♦手牌当作可指定你攻击范围内任意名角色为目标的不计次数的火【杀】使用。此【杀】结算结束后，若有目标未受到伤害，你失去1点体力。",
        ["peta_flare_prompt"] = "爆焰：将一张♦手牌当作可指定任意目标的不计次数的火【杀】使用",
        ["#peta_flare_targetmod"] = "爆焰",
        ["#peta_flare_finish"] = "爆焰",

        ["nuclear_fusion"] = "聚核",
        [":nuclear_fusion"] = "准备阶段，若你的体力上限小于6，你增加1至3点体力上限。",
        ["nuclear_fusion_prompt"] = "聚核：增加体力上限",
        ["@nuclear_fusion"] = "核",
        ["#nuclear_fusion_refresh"] = "聚核",

        ["flaming_sun"] = "灼日",
        [":flaming_sun"] = "觉醒技，当你进入濒死状态时，你回复4点体力并获得“<a href = ':cross_sun'>凶星</a>”和“<a href = ':self_destroy'>崩毁</a>”。",

        ["cross_sun"] = "凶星",
        [":cross_sun"] = "在你失去体力或减少体力上限后，你可以使用一张弃牌堆中点数与你体力上限相同的牌。",

        ["cross_sun_viewas"] = "凶星",
        ["cross_sun_prompt"] = "凶星：你可以使用一张牌",
    }
end
